import Shape from '../core/core.shape';
import { Core } from '../core/core';

type Point = {
  x:number;
  y:number;
}

interface ILine extends Partial<Core.IAttr> {
  start: Point,
  end: Point,
}

export default class Line extends Shape {
  static defaultAttrs: ILine;
  attrs: ILine
  constructor(attrs: ILine) {
    super('line', {});
    this.attrs = { ...super.getAttrs(), ...attrs };
  }
  createPath() {
    const { start,end, ...attrs } = this.attrs;
    const context = this.getProps('context');

    context.strokeStyle = attrs.strokeStyle;

    context.beginPath();
    context.moveTo(start.x,start.y);
    context.lineTo(end.x,end.y);
    console.log('create-line-path');
  }
}